#include<bits/stdc++.h>

#define rp(i,a,b) for(int i=a;i<b;++i)
#define rrp(i,b,a) for(int i=b;i>=a;--i)

using namespace std;

struct node
{
	long long first,second;
	long long sum;
};

bool cmp(node a,node b){
	return a.sum>b.sum;
}

std::vector<node> v;

int main(){
	int n;scanf("%d", &n);
	v.resize(n);
	rp(i , 0 , n){
		scanf("%lld%lld", &v[i].first,&v[i].second);
		v[i].sum = v[i].first+v[i].second + v[i].first;
	}
	sort(v.begin(),v.end(),cmp);
	long long sum1  = 0, sum2 = 0;
	rp(i , 0 , n){
		sum1+=v[i].first;
	}
	rp(i , 0 , n){
		sum2+=v[i].first+v[i].second;
		sum1-=v[i].first;
		// cout<<sum1<<" and "<<sum2<<endl;
		if(sum2>sum1){
			printf("%d\n", i+1);
			return 0;
		}
	}
	
	return 0;
}